<#include "../common/layout/__mainlayout.html">
<#assign pageBreadCrumbs>
    <li class="active"><a href="#">系统管理</a></li>
    <li class="active">数据字典</li>
</#assign>
<#assign pageCss>
    <link rel="stylesheet" href="${ctx}/static/admin/assets/css/jquery-ui.custom.css"/>
    <link rel="stylesheet" href="${ctx}/static/admin/assets/css/datepicker.css"/>
</#assign>

<#assign pageJavascript>
    <script type="text/javascript">
        $(document).ready(function () {
            $('[data-rel=tooltip]').tooltip();

            // 清除远程modal数据
            $("#editModal").on("hidden.bs.modal", function () {
                $(this).removeData("bs.modal");
            });

            // 删除按钮
            $("a.delete").on(ace.click_event, function (e) {
                var currentA = this;
                e.preventDefault();
                bootbox.confirm({
                            message: "确定删除该选项?",
                            buttons: {
                                confirm: {
                                    label: "确定",
                                    className: "btn-primary btn-sm"
                                },
                                cancel: {
                                    label: "取消",
                                    className: "btn-sm"
                                }
                            },
                            callback: function (result) {
                                if (result) window.location.href = $(currentA).attr("href");
                            }
                        }
                );
            });
        });;
    </script>
</#assign>
<@mainlayout pageBreadCrumbs=pageBreadCrumbs pageJavascript=pageJavascript currentMenu="DataDicFlag-dictFlag">

    <div class="row">
        <div class="col-xs-12">
            <form id="searchForm" class="form-search form-inline">
                <label>字典组:</label><input type="text" id="groupValue" name="groupValue" class="input-sm input-small"
                                          value=""/>&nbsp;
                <select name="enable" class="chosen-select input-md" data-placeholder="启用状态">
                    <option value=""></option>
                    <option value="0">启用</option>
                    <option value="1">停用</option>
                </select>&nbsp;
                <input type="submit" id="searchButton" class="btn btn-sm btn-primary" value="查询"/>&nbsp;
                <a href="${ctx}/system/viewDict.do" class="btn btn-sm btn-warning" data-toggle="modal"
                   data-target="#editModal"><i class="ace-icon fa fa-plus"></i>添加</a>
            </form>
            <table id="dictTable" class="table table-striped table-bordered table-hover">
                <thead>
                <tr>
                    <th width="40" align="center">字典id</th>
                    <th width="100" align="left">字典组名称</th>
                    <th width="70" align="left">字典代码</th>
                    <th width="70" align="left">字典名</th>
                    <th width="60" align="left">排序</th>
                    <th width="30" align="center">创建时间</th>
                    <th width="50" align="center">状态</th>
                    <th width="40" align="center">操作</th>
                </tr>
                </thead>
                <tbody>
                <#list dictList.listData as dict>
                    <tr>
                        <td>${dict.id!}</td>
                        <td>${dict.groupValue!}</td>
                        <td>${dict.code!}</td>
                        <td>${dict.name!}</td>
                        <td>${dict.sort!}</td>
                        <td><#if user.sex == 0> <div>男</div> <#else> <div>女</div> </#if></td>
                        <td><#if user.createTime!??>${user.createTime?string("yyyy-MM-dd HH:mm:ss")!} <#else></#if></td>
                        <td><#if user.enable == 0> <div>启用</div> <#else> <div style="color:red">停用</div> </#if></td>
                        <td>
                            <div class="hidden-sm hidden-xs action-buttons">
                                <a class="green tooltip-success edit" href="${ctx}/system/viewDict.do?dictId=${dict.id!}" data-rel="tooltip" title="编辑" data-toggle="modal" data-target="#editModal"><i class="ace-icon fa fa-pencil bigger-130"></i></a>
                                <a class="red tooltip-error delete" href="${ctx}/system/deleteDict.do?dictId=${dict.id!}" data-rel="tooltip" title="删除"> <i class="ace-icon fa fa-trash-o bigger-130"></i></a>
                            </div>

                            <div class="hidden-md hidden-lg">
                                <div class="inline position-relative">
                                    <button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">
                                        <i class="ace-icon fa fa-caret-down icon-only bigger-120"></i>
                                    </button>

                                    <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
                                        <li><a href="${ctx}/system/viewDict.do?dictId=${dict.id!}" class="tooltip-success edit" data-rel="tooltip" title="编辑" data-toggle="modal" data-target="#editModal"> <span class="green"><i class="ace-icon fa fa-pencil-square-o bigger-120"></i></span></a></li>
                                        <li><a href="${ctx}/system/deleteDict.do?dictId=${dict.id!}" class="tooltip-error delete" data-rel="tooltip" title="删除"> <span class="red"><i class="ace-icon fa fa-trash-o bigger-120"></i></span></a></li>
                                    </ul>
                                </div>
                            </div>
                        </td>
                    </tr>
                </#list>
                </tbody>
            </table>
            <@pagination userList!/>
        </div>
    </div>

    <div id="editModal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
            </div>
        </div>
    </div>
</@mainlayout>